package com.tensquare.articlecrawler;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;

import us.codecraft.webmagic.scheduler.RedisScheduler;
import us.codecraft.webmagic.scheduler.Scheduler;

@SpringCloudApplication//三个注解
@EnableFeignClients //远程调用
@EnableScheduling //开启Springtask
public class ArticleCrawlerApplication {

	public static void main(String[] args) {
		
		SpringApplication.run(ArticleCrawlerApplication.class, args);
		
	}
	
	@Value("${spring.redis.host}")
	private String host;
	
	//url去重用的
	@Bean
	public Scheduler scheduler() {
		return new RedisScheduler(host);
	}

}
